What is Method Overriding?
2999
16-Oct-2010
Anonymous User
10-Nov-2010Method overriding, in object oriented programming, is a language feature that allows a subclass or child class to provide a specific implementation of a method that is already provided by one of its superclasses or parent classes. The implementation in the subclass overrides (replaces) the implementation in the superclass by providing a method that has same name, same parameters or signature, and same return type as the method in the parent class.If subclass (child class) has the same method as declared in the parent class, it is known as method overriding in java.
Pushpendra Singh
01-Nov-2010The new method definition must have the same method signature and return type.
Clas A
{
Virtual void sum (int a)
{
}
}
Class B:A
{
public overrid void sum (int a)
{
}
}